<template>
  <div class="tenantMenu_main main_container">
    <div class="main_header">
      <div class="padding_container">
        <div class="left"><Breadcrumb /></div>
        <div class="right">
          <HeaderOperation :parent="this" />
        </div>
      </div>
    </div>
    <div v-loading="loading" class="main_main">
      <SearchBar :parent="this" />
      <div ref="table_container" class="table_container">
        <el-table
          ref="table"
          :data="tableData"
          stripe
          border
          :height="tableHeight"

          :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
          :cell-style="cellStyle"
          @cell-click="cellClick"
          @sort-change="
            (column) => {
              sortChange(column, this);
            }
          "

          @selection-change="
            (val) => {
              selectionChange(val, this);
            }
          "
        >
          <el-table-column type="selection" align="center" />
          <Column
            v-for="(column, index) in tableColumns"
            :key="index"
            :align="column.align"
            :prop="column.prop"
            :is-show="column.isShow"
            :label="column.label"
            :sortable="column.sortable"
            :width="column.width"
            :min-width="column.minWidth"
          />
          <el-table-column
            label="操作"
            align="center"
            fixed="right"
            width="240"
          >
            <template slot-scope="scope">
              <el-button
                v-if="scope.row.status == 0"
                v-hasPermi="['outsource:order:edit']"
                type="text"
                @click.stop="edit(scope.row)"
              >编辑</el-button>
              <span v-else class="el-button--text button_grey">编辑</span>
              <el-button
                v-if="scope.row.status == 0 && scope.row.automaticCreate == 0"
                v-hasPermi="['outsource:order:remove']"
                type="text"
                @click.stop="deleteOne(scope.row)"
              >删除</el-button>
              <span v-else class="el-button--text button_grey">删除</span>
              <el-button
                v-if="scope.row.status == 1 && scope.row.automaticCreate == 0"
                v-hasPermi="['outsource:order:finishOrder']"
                type="text"
                @click.stop="finish(scope.row)"
              >完成</el-button>
              <span v-else class="el-button--text button_grey">完成</span>
              <el-button
                v-if="scope.row.status == 1 && scope.row.automaticCreate == 0"
                v-hasPermi="['outsource:order:stopOrder']"
                type="text"
                @click.stop="stopOrder(scope.row)"
              >终止</el-button>
              <span v-else class="el-button--text button_grey">终止</span>
            </template>
          </el-table-column>
        </el-table>
      </div>
    </div>
    <div class="main_bottom">
      <pagination
        :total="total"
        :page.sync="pageData.pageNum"
        :limit.sync="pageData.pageSize"
        :selected-num="selectionsAll.length"
        @pagination="getList"
      />
    </div>
  </div>
</template>
<script>
import {
  list,
  remove,
  getInfo,
  endOrder,
  terminated
} from '@/api/outsourceManage/outsourceOrder'
import { getInfo as getPlanInfo } from '@/api/planManagement/planProductionOrder'
import { getDictSelects } from '@/api/common/common'
import AddOrUpdate from './addOrUpdate'
import ShowDetail from './showOutsourceOrder.vue' // 查看页面
import showPlanDetail from '@/components/JLINK2/common/ShowDetailTitle.vue' // 计划单号查看页面
// import purchaseEnd from './purchaseEnd'
export default {
  name: 'Index',
  data() {
    return {
      loading: true,
      pageId: '外协订单', // 页面唯一标识
      pageExportId: '外协订单导出', // 页面导出标识
      pageData: {
        pageNum: 1,
        pageSize: 20,
        orderByColumn: 'updateTime',
        isAsc: 'desc'
      },
      // tableKey: 1,
      total: 1, // 数据一共有多少条
      mainId: 'id', // 表格行ID
      tableHeight: '0', // 表格高度
      tableData: [], // 表格数据
      tableColumns: [], // 表格实际用的字段
      searchColumns: [], // 搜索区实际用的字段
      selections: [], // 表格当前页所选中的行
      selectionsAll: [], // 表格所有页选中的行
      defaultTableColumns: [
        // 表格常规字段（初始值）
        { prop: 'statusName', label: '状态', canOrder: false },
        { prop: 'code', label: '外协订单号' },
        { prop: 'orderName', label: '制单人员', canOrder: false },
        { prop: 'orderTime', label: '制单日期' },
        // { prop: 'supplierTypeName', label: '外协类型', canOrder: false },
        { prop: 'productionPlanCode', label: '计划单号' },
        { prop: 'supplierName', label: '外协供应商', canOrder: false },
        {
          prop: 'totalNumber',
          label: '外协总数量',
          minWidth: this.SETTINGS.settings_decimalDigits_length,
          canOrder: false
        },
        { prop: 'remark', label: '备注', canOrder: false },
        {
          prop: 'taxTotalMoneyThousandths',
          label: '含税总金额',
          minWidth: this.SETTINGS.settings_decimalDigits_length,
          align: 'right',
          canOrder: false
        }
      ],
      exportTableColumns: [// 表格常规字段（初始值）
        { prop: 'statusName', label: '状态', canOrder: false },
        { prop: 'code', label: '外协订单号' },
        { prop: 'orderName', label: '制单人员', canOrder: false },
        { prop: 'orderTime', label: '制单日期' },
        // { prop: 'supplierTypeName', label: '外协类型', canOrder: false },
        { prop: 'productionPlanCode', label: '计划单号' },
        { prop: 'supplierName', label: '外协供应商', canOrder: false },
        {
          prop: 'totalNumber',
          label: '外协总数量',
          minWidth: this.SETTINGS.settings_decimalDigits_length,
          canOrder: false
        },
        {
          prop: 'taxTotalMoney',
          label: '含税总金额',
          minWidth: this.SETTINGS.settings_decimalDigits_length,
          align: 'right',
          canOrder: false
        },
        { prop: 'remark', label: '备注', canOrder: false }
      ],
      defaultExport: [],
      defaultSearchColumns: [
        // 搜索区常规字段（初始值）
        { prop: 'code', label: '外协订单号', type: 'input' },
        { prop: 'supplierName', label: '外协供应商', type: 'input' },
        { prop: 'orderTime', label: '制单日期', type: 'time', isTime: true },
        {
          prop: 'statusList',
          label: '状态',
          type: 'select-multiple',
          optionsName: 'statusOptions'
        },
        { prop: 'orderName', label: '制单人员', type: 'input' },
        // {
        //   prop: 'supplierTypeCode',
        //   label: '外协类型',
        //   type: 'dict',
        //   optionsName: 'supplierTypeOptions'
        // },
        { prop: 'productionPlanCode', label: '计划单号', type: 'input' }
        // { prop: 'totalNumber', label: '外协总数量', type: 'input' },
        // { prop: 'taxTotalMoney', label: '含税总金额', type: 'input' }
      ],
      operationData: [
        // 右上角的操作按钮
        { label: '新增', perm: 'outsource:order:add' },
        { label: '打印', perm: 'outsource:order:list' },
        { label: '批量导出3', perm: 'outsource:order:export' },
        { label: '批量删除', perm: 'outsource:order:remove' },
        { label: '页面配置', perm: '' }
      ],
      supplierTypeOptions: [],
      statusOptions: [
        // 选择组件数据源
        // { value: undefined, label: '全部' },
        { value: '0', label: '待提交' },
        { value: '1', label: '已提交' },
        { value: '2', label: '外协中' },
        { value: '3', label: '已完成' },
        { value: '4', label: '已终止' }
      ],
      // 查看详情的配置（根据配置自动生成查看页面）
      showKey: {
        type: 'column_two',
        keys: [
          { type: 'form', name: '外协订单号', key: 'code' }, // type: 'form' 表示是普通的表单展示
          { type: 'form', name: '制单人员', key: 'orderName' },
          { type: 'form', name: '制单日期', key: 'orderTime' },
          // { type: 'form', name: '外协类型', key: 'supplierTypeName' },
          { type: 'form', name: '计划单号', key: 'productionPlanCode' },
          { type: 'form', name: '外协供应商', key: 'supplierName' },
          { type: 'form', name: '外协总数量', key: 'totalNumber' }, // length:'double' 表示占两列
          { type: 'form', name: '含税总金额', key: 'taxTotalMoneyThousandths' },
          { type: 'file', name: '附件', fileName: 'fileName', fileRealName: 'fileRealName', fileUrl: 'url' },
          { type: 'form', name: '备注', key: 'remark', length: 'double' },
          {
            type: 'table',
            name: '',
            key: 'detailList',
            columns: [
              // type: 'table' 表示是表格
              {
                type: 'column',
                name: '工艺要求',
                fixed: 'right',
                key: 'engineeringRequirementCode',
                minWidth: '140'
              },
              {
                type: 'column',
                name: '工序',
                fixed: 'right',
                key: 'engineeringProcessName',
                minWidth: '80'
              },
              {
                type: 'column',
                name: '外协数量',
                fixed: 'right',
                key: 'outsourceNumber',
                minWidth: this.SETTINGS.settings_decimalDigits_length
              },
              {
                type: 'column',
                name: '物料编码',
                key: 'materialCode',
                minWidth: '120'
              }, // type: 'form' 表示是普通的表单展示
              {
                type: 'column',
                name: '物料名称',
                key: 'materialName',
                minWidth: '100'
              },
              {
                type: 'column',
                name: '规格型号',
                key: 'materialModel',
                minWidth: '100'
              },
              {
                type: 'column',
                name: '物料单位',
                key: 'materialUnitName',
                minWidth: '100'
              },
              {
                type: 'column',
                name: '需求数量',
                key: 'needNumber',
                minWidth: this.SETTINGS.settings_decimalDigits_length
              },
              {
                type: 'column',
                name: '含税单价',
                key: 'taxPriceThousandths',
                align: 'right',
                minWidth: '100'
              }, // type: 'form' 表示是普通的表单展示
              {
                type: 'column',
                name: '税率%',
                key: 'taxRateLabel',
                minWidth: this.SETTINGS.settings_decimalDigits_length
              },
              {
                type: 'column',
                name: '含税总金额',
                key: 'totalTaxPrice',
                minWidth: this.SETTINGS.settings_decimalDigits_length
              },
              {
                type: 'column',
                name: '外协交期',
                key: 'outsourceDeliveryTime',
                minWidth: '140'
              },
              { type: 'column', name: '备注', key: 'remark', minWidth: '200' }
            ]
          },
          {
            type: 'table2',
            name: '',
            key: 'scheduleList',
            columns: [
              // type: 'table' 表示是表格
              {
                type: 'column',
                name: '物料编码',
                key: 'materialCode',
                minWidth: '120'
              },
              {
                type: 'column',
                name: '物料名称',
                key: 'materialName',
                minWidth: '100'
              },
              {
                type: 'column',
                name: '工序',
                key: 'engineeringProcessName',
                minWidth: '100'
              },
              {
                type: 'column',
                name: '外协数量',
                key: 'outsourceNumber',
                minWidth: this.SETTINGS.settings_decimalDigits_length
              },
              // {
              //   type: 'column',
              //   name: '已领原料',
              //   key: 'hasRequisitionNumber',
              //   minWidth: this.SETTINGS.settings_decimalDigits_length
              // },
              // {
              //   type: 'column',
              //   name: '已退原料',
              //   key: 'returnNumber',
              //   minWidth: this.SETTINGS.settings_decimalDigits_length
              // }, // type: 'form' 表示是普通的表单展示
              {
                type: 'column',
                name: '完成数量',
                key: 'hasInspectNumber',
                minWidth: this.SETTINGS.settings_decimalDigits_length
              },
              {
                type: 'column',
                name: '合格数量',
                key: 'qualifiedNumber',
                minWidth: this.SETTINGS.settings_decimalDigits_length
              },
              {
                type: 'column',
                name: '不合格数',
                key: 'qualityDisqualificationDisposeNumber',
                minWidth: this.SETTINGS.settings_decimalDigits_length
              },
              {
                type: 'column',
                name: '进度',
                key: 'schedule',
                minWidth: '100'
              }
            ]
          }
        ]
      },
      // 自动流转查看详情的配置（根据配置自动生成查看页面）
      showKey2: {
        type: 'column_two',
        keys: [
          { type: 'form', name: '外协订单号', key: 'code' }, // type: 'form' 表示是普通的表单展示
          { type: 'form', name: '制单人员', key: 'orderName' },
          { type: 'form', name: '制单日期', key: 'orderTime' },
          // { type: 'form', name: '外协类型', key: 'supplierTypeName' },
          { type: 'form', name: '计划单号', key: 'productionPlanCode' },
          { type: 'form', name: '外协供应商', key: 'supplierName' },
          { type: 'form', name: '外协总数量', key: 'totalNumber' }, // length:'double' 表示占两列
          { type: 'form', name: '含税总金额', key: 'taxTotalMoneyThousandths' },
          { type: 'file', name: '附件', fileName: 'fileName', fileRealName: 'fileRealName', fileUrl: 'url' },
          { type: 'form', name: '备注', key: 'remark', length: 'double' },
          {
            type: 'table',
            name: '',
            key: 'detailList',
            columns: [
              // type: 'table' 表示是表格
              {
                type: 'column',
                name: '工艺要求',
                fixed: 'right',
                key: 'engineeringRequirementVersionCode',
                minWidth: '140'
              },
              {
                type: 'column',
                name: '工序',
                fixed: 'right',
                key: 'engineeringProcessName',
                minWidth: '80'
              },
              {
                type: 'column',
                name: '外协数量',
                fixed: 'right',
                key: 'outsourceNumber',
                minWidth: this.SETTINGS.settings_decimalDigits_length
              },
              {
                type: 'column',
                name: '物料编码',
                key: 'materialCode',
                minWidth: '120'
              }, // type: 'form' 表示是普通的表单展示
              {
                type: 'column',
                name: '物料名称',
                key: 'materialName',
                minWidth: '100'
              },
              {
                type: 'column',
                name: '规格型号',
                key: 'materialModel',
                minWidth: '100'
              },
              {
                type: 'column',
                name: '物料单位',
                key: 'materialUnitName',
                minWidth: '100'
              },
              {
                type: 'column',
                name: '需求数量',
                key: 'needNumber',
                minWidth: this.SETTINGS.settings_decimalDigits_length
              },
              {
                type: 'column',
                name: '含税单价',
                key: 'taxPriceThousandths',
                align: 'right',
                minWidth: '100'
              }, // type: 'form' 表示是普通的表单展示
              {
                type: 'column',
                name: '税率%',
                key: 'taxRateLabel',
                minWidth: this.SETTINGS.settings_decimalDigits_length
              },
              {
                type: 'column',
                name: '含税总金额',
                key: 'totalTaxPrice',
                minWidth: this.SETTINGS.settings_decimalDigits_length
              },
              {
                type: 'column',
                name: '外协交期',
                key: 'outsourceDeliveryTime',
                minWidth: '140'
              },
              { type: 'column', name: '备注', key: 'remark', minWidth: '200' }
            ]
          },
          {
            type: 'table2',
            name: '',
            key: 'scheduleList',
            columns: [
              // type: 'table' 表示是表格
              { type: 'column', name: '任务单号', key: 'productionTaskCode', minWidth: '120' }, // type: 'form' 表示是普通的表单展示
              {
                type: 'column',
                name: '物料编码',
                key: 'materialCode',
                minWidth: '120'
              },
              {
                type: 'column',
                name: '物料名称',
                key: 'materialName',
                minWidth: '100'
              },
              {
                type: 'column',
                name: '工序',
                key: 'engineeringProcessName',
                minWidth: '100'
              },
              {
                type: 'column',
                name: '外协数量',
                key: 'outsourceNumber',
                minWidth: this.SETTINGS.settings_decimalDigits_length
              },
              {
                type: 'column',
                name: '已领原料',
                key: 'hasRequisitionNumber',
                minWidth: this.SETTINGS.settings_decimalDigits_length
              },
              {
                type: 'column',
                name: '已退原料',
                key: 'returnNumber',
                minWidth: this.SETTINGS.settings_decimalDigits_length
              }, // type: 'form' 表示是普通的表单展示
              {
                type: 'column',
                name: '完成数量',
                key: 'hasInspectNumber',
                minWidth: this.SETTINGS.settings_decimalDigits_length
              },
              {
                type: 'column',
                name: '合格数量',
                key: 'qualifiedNumber',
                minWidth: this.SETTINGS.settings_decimalDigits_length
              },
              {
                type: 'column',
                name: '不合格数',
                key: 'qualityDisqualificationDisposeNumber',
                minWidth: this.SETTINGS.settings_decimalDigits_length
              },
              {
                type: 'column',
                name: '进度',
                key: 'schedule',
                minWidth: '100'
              }
            ]
          }
        ]
      },
      // 查看详情的配置（根据配置自动生成查看页面）
      planShowkey: { // 查看详情的配置（根据配置自动生成查看页面）
        type: 'column_two',
        keys: [
          { type: 'form', name: '计划单号', key: 'code' }, // type: 'form' 表示是普通的表单展示
          { type: 'form', name: '销售订单', key: 'saleOrderCode' },
          { type: 'form', name: '计划类型', key: 'planTypeLabel' },
          { type: 'form', name: '计划人员', key: 'planPersonName' },
          { type: 'form', name: '计划日期', key: 'planTime' }, // length:'double' 表示占两列
          { type: 'Invoices', name: '生产任务单', key: 'enterWarehouseInvoices', length: 'double' },
          { type: 'form', name: '备注', key: 'remark', length: 'double' },
          {
            type: 'table', name: '物料明细', key: 'unmergeData', columns: [ // type: 'table' 表示是表格
              { type: 'column', name: '物料编码', key: 'materialCode', minWidth: '140' }, // type: 'form' 表示是普通的表单展示
              { type: 'column', name: '物料名称', key: 'materialName', minWidth: '100' },
              { type: 'column', name: '规格型号', key: 'materialModel', minWidth: '100' },
              { type: 'column', name: '物料分类', key: 'materialTypeName', minWidth: '100' },
              { type: 'column', name: '物料单位', key: 'materialUnitName', minWidth: '80' },
              { type: 'column', name: '工艺版本号', key: 'engineeringRequirementVersionCode', minWidth: '100' },
              { type: 'column', name: '客户交期', key: 'saleCustomerDeliveryTime', minWidth: '110' },
              { type: 'column', name: '订单数量', key: 'orderNumber', minWidth: '100' },
              { type: 'column', name: '库存数量', key: 'materialInventory', minWidth: '100' },
              { type: 'column', name: '计划数量', fixed: 'right', key: 'planNumber', Width: this.SETTINGS.settings_decimalDigits_length },
              { type: 'column', name: '计划交期', key: 'planDealTime', minWidth: '110' },
              { type: 'column', name: '备注', key: 'remark', minWidth: '180' }
            ]
          },
          {
            type: 'table', name: '', key: 'productionTaskListVos', columns: [ // type: 'table' 表示是表格
              { type: 'column', name: '任务单号', key: 'code', minWidth: '120' }, // type: 'form' 表示是普通的表单展示
              { type: 'column', name: '物料编码', key: 'materialCode', minWidth: '120' },
              { type: 'column', name: '物料名称', key: 'materialName', minWidth: '100' },
              { type: 'column', name: '规格型号', key: 'materialModel', minWidth: '100' },
              { type: 'column', name: '工序', key: 'engineeringProcessName', minWidth: '100' },
              { type: 'column', name: '是否外协', key: 'productBySelfName', minWidth: '80' },
              { type: 'column', name: '计划数量', key: 'productNumber', Width: this.SETTINGS.settings_decimalDigits_length },
              { type: 'column', name: '完成数量', key: 'finishNumber', Width: this.SETTINGS.settings_decimalDigits_length },
              { type: 'column', name: '合格数量', key: 'qualifiedTotalNumber', Width: this.SETTINGS.settings_decimalDigits_length },
              { type: 'column', name: '不合格数量', key: 'unqualifiedNumber', Width: this.SETTINGS.settings_decimalDigits_length },
              { type: 'column', name: '进度', key: 'schedule', minWidth: '80' }
            ]
          }
        ]
      }
    }
  },
  created() {
    this.getDictOptions()
  },
  mounted() {
    if (this.$store.state.order.isOutsourceManage) {
      this.add()
    }
  },
  methods: {
    cellStyle({ row, column }) {
      if (column.property == 'code') {
        return {
          cursor: 'pointer',
          color: '#387bfc'
        }
      } else if (column.property == 'productionPlanCode') {
        return {
          cursor: 'pointer',
          color: '#387bfc'
        }
      }
    },
    cellClick(row, column, cell) {
      switch (column.property) {
        case 'code':
          this.showDetail(row)
          break
      }
      if (row.productionPlanCode) {
        switch (column.property) {
          case 'productionPlanCode':
            this.showPlanDetail(row)
            break
        }
      }
    },
    getDictOptions() {
      getDictSelects('outsourceSupplierType').then((res) => {
        this.supplierTypeOptions = res.data
      })
    },
    getExportData(data) {
      return list(data)
    },
    refresh() {
      this.pageData.pageNum = 1
      this.getList()
    },
    refresh2() {
      this.tableData = []
      setTimeout(() => {
        this.getList()
      }, 50)
    },
    getList() {
      // this.tableData = []
      list(this.pageData).then((res) => {
        res.data.forEach(ele => {
          ele.canDelete = ele.status == 0 && ele.automaticCreate == 0 ? 1 : 0
        })
        this.tableData = res.data
        this.total = res.total
        this.loading = false
        this.$nextTick(() => {
          this.setSelectRow(this) // 设置行选中
          this.tableHeight = this.$refs.table_container.offsetHeight
        })
      })
    },
    // 外协订单详情
    showDetail(row) {
      getInfo(row[this.mainId]).then((res) => {
        if (res.data.scheduleList.length > 0) {
          res.data.scheduleList.forEach(ele => {
            ele.schedule = parseFloat((ele.qualifiedNumber * 100 / ele.outsourceNumber).toFixed(2)) + '%'
          })
        }
        this.$layer.iframe({
          // 弹框
          content: {
            content: ShowDetail, // 传递的组件对象
            parent: this, // 当前的vue对象
            data: {
              showData: res.data,
              showKey: res.data.automaticCreate == 1 ? this.showKey2 : this.showKey
            } // props
          },
          area: ['1320px', '700px'],
          title: '查看外协订单', // 标题
          shadeClose: false // 点击遮罩是否关闭
        })
      })
    },
    // 计划单号详情
    showPlanDetail(row) {
      getPlanInfo(row.productionPlanId).then(res => {
        // 计算合格数量
        res.data.productionTaskListVos.map((item) => {
          item.finishNumber = item.reportTotalNumber * 1 + item.badnessTotalNumber * 1
          item.unqualifiedNumber = item.disqualifiedTotalNumber * 1 + item.badnessTotalNumber * 1
          item.schedule = parseFloat((item.qualifiedTotalNumber * 100 / item.productNumber).toFixed(2)) + '%'
        })
        this.$layer.iframe({// 弹框
          content: {
            content: showPlanDetail, // 传递的组件对象
            parent: this, // 当前的vue对象
            data: {
              showData: res.data,
              showKey: this.planShowkey
            }// props
          },
          area: ['1320px', '700px'],
          title: '查看生产计划单', // 标题
          shadeClose: false // 点击遮罩是否关闭
        })
      })
    },
    add() {
      this.$layer.iframe({
        // 弹框
        content: {
          content: AddOrUpdate, // 传递的组件对象
          parent: this, // 当前的vue对象
          data: {
            resData:
              this.$store.state.order.outsourceManageData.length > 0
                ? this.$store.state.order.outsourceManageData
                : ''
          } // props
        },
        area: ['1320px', '700px'],
        title: '新增外协订单', // 标题
        shadeClose: false // 点击遮罩是否关闭
      })
    },
    edit(row) {
      this.$layer.iframe({
        // 弹框
        content: {
          content: AddOrUpdate, // 传递的组件对象
          parent: this, // 当前的vue对象
          data: {
            id: row[this.mainId]
          } // props
        },
        area: ['1320px', '700px'],
        title: '编辑外协订单', // 标题
        shadeClose: false // 点击遮罩是否关闭
      })
    },
    finish(row) {
      getInfo(row.id).then((res) => {
        this.$confirm('是否确认完成订单?', '完成确认', {
          confirmButtonText: '确 定',
          cancelButtonText: '取 消',
          cancelButtonClass: 'cancelConfirm',
          type: 'warning'
        }).then(() => {
          res.data.status = '3'
          endOrder({ ...res.data }).then((res2) => {
            this.$message.success('操作成功')
            this.getList()
          })
        })
      })

      //   deleteById({ fuId: row.fuId, fileSaveName: row.fileSaveName }).then(res => {
      //     if (res && res.result == 'success') {
      //       this.$message({
      //         message: '删除成功',
      //         type: 'success',
      //         duration: 1000
      //       })
      //       this.getList()
      //     }
      //   }).finally(() => {
      //     this.loading = false
      //   })
      // })
    },
    stopOrder(row) {
      this.$confirm('是否确认终止订单?', '终止确认', {
        confirmButtonText: '确 定',
        cancelButtonText: '取 消',
        cancelButtonClass: 'cancelConfirm',
        type: 'warning'
      }).then(() => {
        terminated(row.id).then((res2) => {
          this.$message.success('操作成功')
          this.getList()
        })
      })
    },
    deleteOne(row) {
      const _this = this
      this.$confirm('确定要删除吗', '删除确认', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        cancelButtonClass: 'cancelConfirm',
        type: 'warning'
      })
        .then(function() {
          remove(row[_this.mainId]).then((res) => {
            _this.$message({
              message: res.msg,
              type: 'success'
            })
            _this.selectionsAll = []
            _this.getList()
          })
        })
        .catch(() => {})
    },
    // 当前页的删除接口
    deleteMethod(deleteIds) {
      return remove(deleteIds)
    }
  }
}
</script>

<style lang="less" scoped>
</style>
